//
//  NSObject+AssociatedObject.m
//  Objective-C
//
//  Created by S_Line on 2018/8/2.
//  Copyright © 2018年 S_Line. All rights reserved.
//

#import "NSObject+AssociatedObject.h"

#import <UIKit/UIKit.h>
#import <objc/runtime.h>

@implementation NSObject (AssociatedObject)

static void* const kNSObjectNameKey = @"kNSObjectNameKey";

- (NSString *)name {
    return objc_getAssociatedObject(self, kNSObjectNameKey);
}

- (void)setName:(NSString *)name {
    objc_setAssociatedObject(self, kNSObjectNameKey, name, OBJC_ASSOCIATION_COPY_NONATOMIC);
}

@end
